﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>引入实体</title>
    <link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>

    <link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../Style/skin/css/Default.css" rel="stylesheet" />
    <script src="../EnumLab.js"></script>
    <script type="text/javascript">

        var entityType = 2;
        var frmTreeNo = "";
        var module = null;
        $(function () {

            var moduleNo = GetQueryString("ModuleNo");

            //设置树的编号,树的编号与系统编号一致.
            module = new Entity("BP.CCFast.CCMenu.Module", moduleNo);
            frmTreeNo = module.SystemNo;


            InitBar(MenuModel.DictRef);
            var html = "";
            var ens = new Entities("BP.Sys.MapDatas");
            ens.Retrieve("EntityType", 2);
            //创建表单类型.
            GenerBindDDL("DDL_FormDict", ens, "No","Name");
        });

        function Save() {

            $("#Msg").html("正在创建,请稍后......");
            var no = $("#DDL_FormDict").val();
            if (no == null || no == "") {
                alert("请选择引入的实体表单");
                return;
            }
            

            //更新节点表单类型.
            var moduleNo = GetQueryString("ModuleNo");
            var en = new Entity("BP.CCFast.CCMenu.Menu");
            en.ModuleNo = moduleNo;
            en.SystemNo = module.SystemNo; //系统编号.
            en.Name = $("#DDL_FormDict option:selected").text();
            en.UrlExt = no;

            en.MenuModel = MenuModel.Dict; //类型为.

            //查看的模式.
            if (document.getElementById("RB_ListModel_0").checked == true)
                en.ListModel = 0;
            else
                en.ListModel = 1;

            en.WorkType = "0"; //自定义菜单.
            en.Insert();
            alert("创建成功，您可以在在菜单里执行高级编辑与授权.");

            SetHref("../../Comm/En.htm?EnName=BP.CCFast.CCMenu.Menu&No=" + en.No);

        }

        function GenerPinYin() {

            //是否是全拼.
            var isQuanPin = 0;
            if (document.getElementById("RB_ZZMM_0").checked == true)
                isQuanPin = 1;

            // var name = $('#TB_Nam').val();
            var name = document.getElementById("TB_Name").value;
            if (name == "")
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.Admin_CCFormDesigner");
            handler.AddPara("IsQuanPin", isQuanPin);
            handler.AddPara("TB_Name", encodeURIComponent(name));
            var data = handler.DoMethodReturnString("NewFrmGuide_GenerPinYin");

            $("#Msg").html("");

            if (data.indexOf('err@') >= 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }
            var webUser = new WebUser();
            var keyOrg = webUser.FK_Dept + "_CCFrm_" + data;
            var key = "CCFrm_" + data;

            var frmType = $("#DDL_FrmType").val();
            if (frmType != "3" && frmType != "7") {

                if (entityType == 0)
                    key = "Frm_" + data;
                keyOrg = webUser.FK_Dept + "_Frm_" + data;
                if (entityType == 1)
                    key = "Bill_" + data;
                keyOrg = webUser.FK_Dept + "_Bill_" + data;
                if (entityType == 2)
                    key = "Dict_" + data;
                keyOrg = webUser.FK_Dept + "_Dict_" + data;
            }

            $('#TB_No').val(key);
            $('#TB_PTable').val(key);
            $('#TB_No_Org').val(keyOrg);
            $('#TB_PTable_Org').val(keyOrg);
            return;
        }
    </script>
</head>
<body>
    <form id="CCForm">
        <div id="bar">
        </div>
        <fieldset>
            <legend>引入实体 </legend>

            <h3>请选择要引用的实体.</h3>

            <select id="DDL_FormDict"></select>

            <table>


                <tr>
                    <td> 列表模式</td>
                    <td>
                        <input id="RB_ListModel_0" type="radio" name="RB_ListModel" value="0" checked="true" /><label for="RB_ListModel_0">编辑模式</label>
                        <input id="RB_ListModel_1" type="radio" name="RB_ListModel" value="1" /><label for="RB_ListModel_1">视图模式</label>
                    </td>
                </tr>

                <tr>
                    <td colspan="2">
                        备注：更多的属性在创建后可以修改，比如：存储表，导入字段，表单模式。
                    </td>
                </tr>
            </table>
            <!--<input type="button" id="Btn_Save" value="创建" onclick="Save();" />-->

            <div id="Msg"></div>
        </fieldset>

        <fieldset>
            <legend id="help"></legend>
            <ul>
                

            </ul>
        </fieldset>
    </form>
</body>
</html>
